package cn.itsource.system.service.impl;


import cn.itsource.basic.util.PageResult;
import cn.itsource.system.domain.TSystemdictionarydetail;
import cn.itsource.system.query.TSystemdictionarydetailQuery;
import cn.itsource.system.service.TSystemdictionarydetailService;
import cn.itsource.system.mapper.TSystemdictionarydetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 26871
* @description 针对表【t_systemdictionarydetail】的数据库操作Service实现
* @createDate 2024-05-06 10:04:15
*/
@Service
public class TSystemdictionarydetailServiceImpl implements TSystemdictionarydetailService{

    @Autowired
    private TSystemdictionarydetailMapper tSystemdictionarydetailMapper;

    @Override
    public void insert(TSystemdictionarydetail tSystemdictionarydetail) {
        tSystemdictionarydetailMapper.insert(tSystemdictionarydetail);

    }

    @Override
    public void delete(Long id) {
        tSystemdictionarydetailMapper.delete(id);

    }

    @Override
    public void update(TSystemdictionarydetail tSystemdictionarydetail) {
        tSystemdictionarydetailMapper.update(tSystemdictionarydetail);

    }

    @Override
    public TSystemdictionarydetail selectById(Long id) {

        return tSystemdictionarydetailMapper.selectById(id);
    }

    @Override
    public void save(TSystemdictionarydetail tSystemdictionarydetail) {
        if (tSystemdictionarydetail.getId() == null){
            tSystemdictionarydetailMapper.insert(tSystemdictionarydetail);
        }else {
            tSystemdictionarydetailMapper.update(tSystemdictionarydetail);
        }

    }

    @Override
    public void patchDelete(List<Long> ids) {
        tSystemdictionarydetailMapper.patchDelete(ids);

    }

    @Override
    public List<TSystemdictionarydetail> selectAll() {

        return tSystemdictionarydetailMapper.selectAll();
    }

    @Override
    public PageResult<TSystemdictionarydetail> selectByQueryPage(TSystemdictionarydetailQuery tSystemdictionarydetailQuery,Long typesId) {
        Integer total = tSystemdictionarydetailMapper.selectCount(tSystemdictionarydetailQuery,typesId);
        List<TSystemdictionarydetail> list = tSystemdictionarydetailMapper.selectByQueryPage(tSystemdictionarydetailQuery,typesId);
        System.out.println(tSystemdictionarydetailQuery.getKeyword());
        return new PageResult<TSystemdictionarydetail>(total,list);
    }

}
